# coding: utf-8

import os
import sys
import time

VERSION = sys.version_info[0]
LINESEP = os.linesep
PLATFORM = sys.platform
DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S'
TIMESTAMP = time.strftime('%Y%m%d%H%M%S', time.localtime())

BASE_PATH = os.getcwd()
APP_PATH = os.path.join(BASE_PATH, 'app')
DATA_PATH = os.path.join(BASE_PATH, 'data')
RESOURCE_PATH = os.path.join(APP_PATH, 'resource')
RESOURCE_IMAGES_PATH = os.path.join(RESOURCE_PATH, 'images')
RESOURCE_STYLE_PATH = os.path.join(RESOURCE_PATH, 'style')

DATA_FOLDER = os.path.join(BASE_PATH, 'data/')

LOG_NAME = 'yehun-redis-desktop-manager'
LOG_FOLDER = os.path.join(BASE_PATH, 'logs/')
LOG_FILE = os.path.join(LOG_FOLDER, 'log')
LOG_FORMAT = '[%(asctime)s][%(process)s][%(thread)s][%(levelname)s]: %(message)s'
LOG_DATETIME_FORMAT = '%m-%d %H:%M:%S'
LOG_FILE_ENABLE = True
LOG_CONF = os.path.join(DATA_PATH, 'logger.ini')

RESOURCE_STYLE_SHEET = os.path.join(RESOURCE_STYLE_PATH, 'default.qss')

MAIN_WINDOW_SIZE = (980, 812)
MAIN_WINDOW_RATIO = 0.6
MAIN_WINDOW_TITLE = 'yehun-redis-manager'


REDIS_DEFAULT_HOST = 'localhost'
REDIS_DEFAULT_PORT = 6379

STORAGE_ECHO = False
STORAGE_ENCODING = 'utf-8'

SQLITE_URL = 'sqlite:///data/data.db'


REDIS_CLIENT = (('client1', '127.0.0.1', 6379, None), ('client2', '127.0.0.1', 6379, None), )

REDIS_CLUSTER = (
    'cluster',
    [
        ('10.168.2.39', 7000),
        ('10.168.2.39', 7001),
        ('10.168.2.39', 7002),
        ('10.168.2.39', 7003),
        ('10.168.2.39', 7004),
        ('10.168.2.39', 7005)
    ], '123456@'
)



ICON_KEY='key.svg'
ICON_CLUSTER='cluster.svg'
ICON_SERVER = 'server.svg'
ICON_DATABASE = 'database.svg'
ICON_EDIT_DB = 'editdb.svg'
ICON_SAVE = 'execute.svg'
ICON_ADD = 'add.svg'
ICON_DEL = 'delete.svg'
ICON_TTL = 'ttl.svg'
ICON_UA = 'ua.svg'
ICON_REFRESH = 'refresh.svg'
ICON_LOG = 'log.svg'
ICON_LOGO = 'logo.svg'
ICON_HELP = 'help.svg'
ICON_OFFLINE = 'offline.svg'
ICON_CLEAR = 'clear.svg'

ICONS = (
    ICON_KEY, ICON_CLUSTER, ICON_SERVER, ICON_DATABASE, ICON_EDIT_DB,
    ICON_SAVE, ICON_ADD, ICON_DEL, ICON_TTL, ICON_UA, ICON_REFRESH,
    ICON_LOG, ICON_LOGO, ICON_HELP, ICON_OFFLINE, ICON_CLEAR
)
